//
//  TeamHistoryFileMessageController.swift
//  NETeamUIKit
//
//  Created by Laura on 2024/7/31.
//


import NIMSDK
import UIKit

@objcMembers
open class TeamHistoryFileMessageController: NEBaseTeamHistoryFileMessageController {
  override public init(teamId: String?) {
    super.init(teamId: teamId)
    tag = "TeamHistoryFileMessageController"
  }

  public required init?(coder: NSCoder) {
    super.init(coder: coder)
  }

  override open func setupSubviews() {
      super.setupSubviews()
      view.backgroundColor = .normalTeamBackColor
      tableView.backgroundColor = .normalTeamBackColor
      
      NSLayoutConstraint.activate([
        tableView.rightAnchor.constraint(equalTo: view.rightAnchor),
        tableView.leftAnchor.constraint(equalTo: view.leftAnchor),
        tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
        tableView.topAnchor.constraint(equalTo: view.topAnchor, constant: NEConstant.navigationAndStatusHeight),
      ])

      tableView.register(
        TeamSearchFileCell.self,
        forCellReuseIdentifier: "\(NSStringFromClass(TeamSearchFileCell.self))"
      )
      
  }
    
    override open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(
            withIdentifier: "\(NSStringFromClass(TeamSearchFileCell.self))",
            for: indexPath
        ) as! NEBaseTeamSearchFileCell
        let message = viewModel.searchFileResultInfos[indexPath.row]
        cell.configData(message: message)
        cell.backgroundColor = UIColor.white
        cell.backgroundView?.backgroundColor = UIColor.white
        cell.contentView.backgroundColor = UIColor.white
        return cell
    }
    
}
